package com.leyou.common;

import java.util.ArrayList;
import java.util.List;

public class Test {

    public static void main(String[] args) {
//        int count = 1;
//        for(int i = 1; i <= 5; i++)count += i;
//        System.out.println(count);

//        String s1 = "abc",s2 = "abc";
//        if(s1 == s2)System.out.print("Same");
//        if(s1.equals(s2))System.out.print("Equals");

        List<String> list = new ArrayList<String>();
        list.add("0");
        list.add("1");
        executeObj(list);
        list.add("2");
        System.out.println(list);
        String num = "10";
        executeInt(num);
        System.out.println(num);

        try{
            myException0();
            System.out.println(myException1());
            myException2();
        }catch(Exception e){
            try {
                System.out.println(myException3());
            } catch (Exception e1) {
                System.out.println(e1.getMessage());
            }
        }


       if(3*0.1 ==0.3){
           System.out.println("111111111111");
       }


    }

    private static void executeObj(List<String> list){
        list.add("end");
    }

    private static void executeInt(String num){
        num = "100";
    }

    public static void myException0(){
        System.out.println("0");
    }

    @SuppressWarnings("unused")
    public static String myException1() throws Exception{
        try{
            int i= 1/0;
            System.out.println("1");
        }catch(Exception e){
            return "len1";
        }
        return "len0";
    }

    @SuppressWarnings("unused")
    public static void myException2(){
        int i= 1/0;
        System.out.println("2");
    }

    @SuppressWarnings("unused")
    public static String myException3() throws Exception{
        try{
            int i= 1/0;
            System.out.println("3");
        }catch(Exception e){
            throw new Exception("throw new Exception");
        }
        return "len3";
    }
}
